package org.infodavid.common.ejb.components;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.Embedded;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;

import org.hibernate.annotations.Target;

import org.infodavid.common.impl.model.LocationImpl;
import org.infodavid.common.model.components.IGeoLocation;
import org.infodavid.common.persistence.ICommented;

/**
 * The Class LocationComponent.
 */
@Embeddable
public class LocationComponent extends LocationImpl {

	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = 1660345027625851664L;

	/**
	 * The Constructor.
	 * @throws Exception the exception
	 */
	protected LocationComponent() throws Exception {
		super();
	}

	/*
	 * (non-Javadoc)
	 * @see org.infodavid.common.model.entities.impl.LocationImpl#getName()
	 */
	@Override
	@Column(name = NAME, length = 32, nullable = true, unique = false)
	public String getName() {
		return super.getName();
	}

	/*
	 * (non-Javadoc)
	 * @see org.infodavid.common.model.entities.impl.LocationImpl#getAddress()
	 */
	@Override
	@Column(name = ADDRESS, length = 512, nullable = true, unique = false)
	public String getAddress() {
		return super.getAddress();
	}

	/*
	 * (non-Javadoc)
	 * @see org.infodavid.common.model.entities.impl.LocationImpl#getType()
	 */
	@Override
	@Enumerated(EnumType.STRING)
	@Column(name = TYPE, nullable = false, length = 16)
	public ELocationType getType() {
		return super.getType();
	}

	/*
	 * (non-Javadoc)
	 * @see org.infodavid.common.impl.model.LocationImpl#getGeoLocation()
	 */
	@Override
	@Embedded
	@Target(value = GeoLocationComponent.class)
	public IGeoLocation getGeoLocation() {
		return super.getGeoLocation();
	}

	/*
	 * See super class or interface. (non-Javadoc)
	 * @see org.infodavid.common.impl.model.LocationImpl#getComment()
	 */
	@Override
	@Column(name = ICommented.COMMENT, length = 1024, nullable = true)
	public String getComment() {
		return super.getComment();
	}

	/*
	 * (non-Javadoc)
	 * @see org.infodavid.common.model.entities.impl.CityImpl#getCountry()
	 */
	@Override
	@Column(name = COUNTRY, length = 32, nullable = false, unique = false)
	public String getCountry() {
		return super.getCountry();
	}

	@Override
	@Column(name = CITY, length = 96, nullable = false, unique = false)
	public String getCity() {
		return super.getCity();
	}

	@Override
	@Column(name = STATE, length = 32, nullable = true, unique = false)
	public String getState() {
		return super.getState();
	}

	@Override
	@Column(name = ZIP_CODE, length = 12, nullable = false, unique = false)
	public String getZipCode() {
		return super.getZipCode();
	}
}
